package com.learn.file.controller;

import com.learn.file.model.FileReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

/**
 * @author : Yu.Tan
 * @date : 2023/6/5 14:46
 * @desc : **
 */
@RestController
@RequestMapping("/file")
@Api(tags = "文件传输")
public class FileController {

    @PostMapping("/upload")
    @ApiOperation(value = "图片文件上传")
    public String onlyStoreImg(@RequestBody FileReq request){
        File file = request.getFile();
        String name = file.getName();
        return request.getSuffix();
    }
}
